import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/home',
    name: 'Home',
    children: [{
      path: 'home',
      component: () => import('@/views/home/index'),
      meta: { title: '应用概况', icon: 'example' }
    }]
  },

  {
    path: '/user',
    component: Layout,
    redirect: '/user/list',
    name: 'User',
    meta: { title: '用户信息', icon: 'user' },
    children: [
      {
        path: 'list',
        name: 'List',
        component: () => import('@/views/list/index'),
        meta: { title: '用户列表', icon: 'table' }
      },
      {
        path: 'detail',
        name: 'Detail',
        hidden: true,
        component: () => import('@/views/detail/index'),
        meta: { title: '用户每日阅读', icon: 'form' }
      },
      {
        path: 'shareList',
        name: 'ShareList',
        hidden: true,
        component: () => import('@/views/shareList/index'),
        meta: { title: '下级好友收益详情', icon: 'form' }
      },
      {
        path: 'feedback',
        name: 'Feedback',
        component: () => import('@/views/feedback/index'),
        meta: { title: '用户反馈列表', icon: 'form' }
      },
      {
        path: 'tree',
        name: 'Tree',
        component: () => import('@/views/tree/index'),
        meta: { title: '实名认证列表', icon: 'tree' }
      },
      {
        path: 'unusual',
        name: 'Unusual',
        component: () => import('@/views/unusual/index'),
        meta: { title: '异常用户列表', icon: 'nested' }
      },
      {
        path: 'message',
        name: 'Message',
        component: () => import('@/views/message/index'),
        meta: { title: '消息列表', icon: 'example' }
      },
      {
        path: 'circle',
        name: 'Circle',
        component: () => import('@/views/circle/index'),
        meta: { title: '发帖列表', icon: 'message' }
      },
      {
        path: 'report',
        name: 'Report',
        component: () => import('@/views/report/index'),
        meta: { title: '举报列表', icon: 'link' }
      }
    ]
  },

  {
    path: '/version',
    component: Layout,
    redirect: '/version',
    name: 'Version',
    children: [{
      path: 'home',
      component: () => import('@/views/version/index'),
      meta: { title: '版本更新', icon: 'eye' }
    }]
  },

  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
